Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 27.1
A dungeon door that slides open and closed based on visibility. |
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8 # The VRML 2.0 Sourcebook # Copyright (c) 1997 # Andrea L. Ames, David R. Nadeau, and John L. Moreland Group { children [ NavigationInfo { headlight FALSE }, # Room Inline { url "droom.wrl" }, # Wall Transform { translation 0.0 0.0 -5.0 children Inline { url "dwall2.wrl" } }, # Left and right door panels Transform { translation 0.0 0.0 -4.95 children [ DEF LeftDoor Transform { children Transform { translation -0.75 0.0 0.0 children DEF Door Inline { url "ddoor.wrl" } } }, DEF RightDoor Transform { children Transform { translation 0.75 0.0 0.0 children USE Door } }, # Visibility Sensor DEF DoorSense VisibilitySensor { center 0.0 1.75 0.0 size 3.0 2.5 1.0 } ] }, # Sounds Sound { source DEF OpenSound AudioClip { url "clunk1.wav" } minFront 20.0 minBack 20.0 maxFront 60.0 maxBack 60.0 }, Sound { source DEF CloseSound AudioClip { url "clunk1.wav" } minFront 20.0 minBack 20.0 maxFront 60.0 maxBack 60.0 }, # Animation clocks DEF OpenClock TimeSensor { cycleInterval 0.5 }, DEF CloseClock TimeSensor { cycleInterval 0.5 }, # Animation paths for the left and right doors DEF LeftOpen PositionInterpolator { key [ 0.0, 1.0 ] keyValue [ 0.0 0.0 0.0, -1.3 0.0 0.0 ] }, DEF LeftClose PositionInterpolator { key [ 0.0, 1.0 ] keyValue [ -1.3 0.0 0.0, 0.0 0.0 0.0 ] }, DEF RightOpen PositionInterpolator { key [ 0.0, 1.0 ] keyValue [ 0.0 0.0 0.0, 1.3 0.0 0.0 ] }, DEF RightClose PositionInterpolator { key [ 0.0, 1.0 ] keyValue [ 1.3 0.0 0.0, 0.0 0.0 0.0 ] } ] } ROUTE DoorSense.enterTime TO OpenSound.set_startTime ROUTE DoorSense.exitTime TO OpenSound.set_stopTime ROUTE DoorSense.enterTime TO OpenClock.set_startTime ROUTE DoorSense.exitTime TO OpenClock.set_stopTime ROUTE DoorSense.exitTime TO CloseSound.set_startTime ROUTE DoorSense.enterTime TO CloseSound.set_stopTime ROUTE DoorSense.exitTime TO CloseClock.set_startTime ROUTE DoorSense.enterTime TO CloseClock.set_stopTime ROUTE OpenClock.fraction_changed TO LeftOpen.set_fraction ROUTE OpenClock.fraction_changed TO RightOpen.set_fraction ROUTE CloseClock.fraction_changed TO LeftClose.set_fraction ROUTE CloseClock.fraction_changed TO RightClose.set_fraction ROUTE LeftOpen.value_changed TO LeftDoor.set_translation ROUTE LeftClose.value_changed TO LeftDoor.set_translation ROUTE RightOpen.value_changed TO RightDoor.set_translation ROUTE RightClose.value_changed TO RightDoor.set_translation